package org.fixed.dubboconsumer.config.error;

import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 〈一句话功能简述>
 * ${DESCRIPTION}
 * Author:xuzhongwei
 * Date:2019/2/20
 */
@Component
public class MyErrorViewResolver implements ErrorViewResolver {

    /**
     * 自定义错误页面
     * @param request
     * @param status
     * @param model
     * @return
     */
    @Override
    public ModelAndView resolveErrorView(HttpServletRequest request, HttpStatus status, Map<String, Object> model) {
        ModelAndView view = new ModelAndView("error/error", model);
        return view;
    }
}
